package name.huzhenbo.java.collection;

import java.util.LinkedList;
import java.util.List;

public class Stack<T> {
    private List<T> list = new LinkedList<T>();

    public void push(T t) {
        list.add(t);
    }

    public List<T> getList() {
        return list;
    }

    public T pop() {
        return list.size() > 0 ? list.remove(list.size() - 1) : null;
    }

    public T first() {
        return list.get(list.size() - 1);
    }

    public boolean empty() {
        return list.size() == 0;
    }
}

